nl.justobjects.pushlet.core
Class SessionManager

java.lang.Object
  extended by nl.justobjects.pushlet.core.SessionManager
All Implemented Interfaces:
ConfigDefs

public class SessionManager
extends java.lang.Object
implements ConfigDefs

Manages lifecycle of Sessions.

Version:
$Id: SessionManager.java,v 1.12 2007/12/04 13:55:53 justb Exp $
Author:
Just van den Broecke - Just Objects ©

Field Summary
 
Fields inherited from interface nl.justobjects.pushlet.core.ConfigDefs
CONTROLLER_CLASS, DISPATCHER_CLASS, LISTEN_FORCE_PULL_AGENTS, LISTEN_FORCE_PULL_ALL, LOG_LEVEL, LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_FATAL, LOG_LEVEL_INFO, LOG_LEVEL_TRACE, LOG_LEVEL_WARN, LOGGER_CLASS, POLL_REFRESH_TIMEOUT_MILLIS, POLL_REFRESH_WAIT_MAX_MILLIS, POLL_REFRESH_WAIT_MIN_MILLIS, PULL_REFRESH_TIMEOUT_MILLIS, PULL_REFRESH_WAIT_MAX_MILLIS, PULL_REFRESH_WAIT_MIN_MILLIS, QUEUE_READ_TIMEOUT_MILLIS, QUEUE_SIZE, QUEUE_WRITE_TIMEOUT_MILLIS, SESSION_CLASS, SESSION_ID_GENERATION, SESSION_ID_GENERATION_RANDOMSTRING, SESSION_ID_GENERATION_UUID, SESSION_ID_SIZE, SESSION_MANAGER_CLASS, SESSION_TIMEOUT_MINS, SOURCES_ACTIVATE, SUBSCRIBER_CLASS, SUBSCRIPTION_CLASS
 
Method Summary
 void addSession(Session session)
          Add session.
 void apply(java.lang.Object visitor, java.lang.reflect.Method method, java.lang.Object[] args)
          Visitor pattern implementation for Session iteration.
 Session createSession(Event anEvent)
          Create new Session (but add later).
static SessionManager getInstance()
          Singleton pattern: get single instance.
 Session getSession(java.lang.String anId)
          Get Session by session id.
 int getSessionCount()
          Get number of listening Sessions.
 Session[] getSessions()
          Get copy of listening Sessions.
 java.lang.String getStatus()
          Get status info.
 boolean hasSession(java.lang.String anId)
          Is Session present?.
 Session removeSession(Session aSession)
          Register session for removal.
 void start()
          Starts us.
 void stop()
          Stopis us.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

apply

public void apply(java.lang.Object visitor,
                  java.lang.reflect.Method method,
                  java.lang.Object[] args)
Visitor pattern implementation for Session iteration.

This method can be used to iterate over all Sessions in a threadsafe way. See Dispatcher.multicast and broadcast methods for examples.

Parameters:
visitor - the object that should implement method parm
method - the method to be called from visitor
args - arguments to be passed in visit method, args[0] will always be Session object

createSession

public Session createSession(Event anEvent)
                      throws PushletException
Create new Session (but add later).

Throws:
PushletException

getInstance

public static SessionManager getInstance()
Singleton pattern: get single instance.


getSession

public Session getSession(java.lang.String anId)
Get Session by session id.


getSessions

public Session[] getSessions()
Get copy of listening Sessions.


getSessionCount

public int getSessionCount()
Get number of listening Sessions.


getStatus

public java.lang.String getStatus()
Get status info.


hasSession

public boolean hasSession(java.lang.String anId)
Is Session present?.


addSession

public void addSession(Session session)
Add session.


removeSession

public Session removeSession(Session aSession)
Register session for removal.


start

public void start()
           throws PushletException
Starts us.

Throws:
PushletException

stop

public void stop()
Stopis us.